﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.IO.IsolatedStorage;
using iRemoteComputing.Phone.Labb1;

namespace iRemoteComputing.Phone.Pages
{
    public partial class BrowsePage : PhoneApplicationPage
    {
        private List<string> citiesToCalc = new List<string>();
        public double TotalDistance = 0;
        IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

        public BrowsePage()
        {
            InitializeComponent();
        }

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            int id = Convert.ToInt16(NavigationContext.QueryString["id"]);
            List<Calcs> calcs = (List<Calcs>)settings["savedCalcs"];
            this.CitiesList.ItemsSource = calcs[id].calc.Result;
            this.PageTitle.Text = "ID: " + calcs[id].calc.Id.ToString();
            this.TextBlockDistance.Text = "Total Distance: " + calcs[id].calc.Distance.ToString();

            base.OnNavigatedTo(e);
        }
    }
}